
import 'package:flutter/material.dart';
import 'package:flutter_repo/chapter06/unit10/custom_scroll/custom_scroll_view.dart';
import 'package:flutter_repo/chapter06/unit10/sliver/sliver_page.dart';

class Unit10 extends StatelessWidget {

  Unit10({Key? key}) : super(key: key);

  final tabs = ["CustomScrollView", "Sliver"];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: tabs.length,
        child: Scaffold(
          appBar: AppBar(
            title: const Text("CustomScrollView & Sliver"),
            bottom: TabBar(
              tabs: tabs.map((e) => Tab(text: e,)).toList(),
            ),
          ),
          body: TabBarView(
            children: [
              KeepAlive(keepAlive: true, child: CustomScrollPage()),
              KeepAlive(keepAlive: true, child: SliverPage()),
            ],
          ),
        )
    );
  }
}